//
//  SketchProtocol.java
//  SketchServer
//
//  Created by Brian Hinch on 9/9/08.
//  Copyright 2008 Tellart. All rights reserved.
//

public class SketchProtocol {

    public static final int MESSAGE_BYTES_PER_VALUE             = 2;
    public static final int SET_MESSAGE_NUM_VALUES              = 10;
    public static final int SET_MESSAGE_LENGTH                  = 1 + (SET_MESSAGE_NUM_VALUES * MESSAGE_BYTES_PER_VALUE);
    public static final int GET_MESSAGE_LENGTH                  = 1;
    public static final int LONGEST_POSSIBLE_MESSAGE_LENGTH     = SET_MESSAGE_LENGTH; //no message length may be greater than this value
    
    public static final int MESSAGE_OFFSET_OPCODE               = 0;
    public static final int MESSAGE_OPCODE_LENGTH               = 1;
    
    public static final byte GET_MESSAGE_OPCODE                 = (byte)0x81;   // 1000 0001 - the cast is needed to reassure the compiler that we're not loosing precision
    public static final byte SET_MESSAGE_OPCODE                 = (byte)0x83;   // 1000 0011 - the cast is needed to reassure the compiler that we're not loosing precision
    
    public static final byte MESSAGE_OPCODE_MASK                = 0x01;         // 1000 0000
    public static final byte MESSAGE_VALUE_MASK                 = 0x0F;         // 0000 1111

    public static final int OUTGOING_SET_MESSAGE_RESEND_COUNT   = 10;
    public static final int OUTGOING_SET_MESSAGE_RESEND_DELAY   = 100;
    
    public static final int GET_RESPONSE_TIMEOUT_MS            = 25;

}
